import { Injectable } from '@nestjs/common';
import { CreatePunchFoodDto, UpdatePunchFoodDto } from './dto/punch-food.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { PunchFood } from '../entities';

@Injectable()
export class PunchFoodService {
  constructor(
    @InjectRepository(PunchFood)
    private readonly punchFoodRepository: Repository<PunchFood>,
  ) {}

  create(createPunchFoodDto: CreatePunchFoodDto) {
    return this.punchFoodRepository.save(createPunchFoodDto);
  }

  findAll() {
    return this.punchFoodRepository.find();
  }

  findOne(punchFoodId: number) {
    return this.punchFoodRepository.findOne({ where: { punchFoodId } });
  }

  update(punchFoodId: number, updatePunchFoodDto: UpdatePunchFoodDto) {
    return this.punchFoodRepository.update(punchFoodId, updatePunchFoodDto);
  }

  remove(punchFoodId: number) {
    return this.punchFoodRepository.delete(punchFoodId);
  }
}
